package com.google.code.virtualhockey.vhx.client.vp.helper;

import com.google.code.virtualhockey.vhx.client.model.JsNationalUnion;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.view.client.AsyncDataProvider;
import com.google.gwt.view.client.HasData;
import com.google.gwt.view.client.TreeViewModel;

/**
 * Model for the country navigation tree.
 */
public class CountryTreeModel implements TreeViewModel {

  private static class NationalUnionDataProvider extends AsyncDataProvider<JsNationalUnion> {
    @Override
    protected void onRangeChanged( HasData<JsNationalUnion> destination ) {
      //To change body of implemented methods use File | Settings | File Templates.
    }
  }

  private static class NationalUnionCell extends AbstractCell<JsNationalUnion> {
    @Override
    public void render( Context context, JsNationalUnion union, SafeHtmlBuilder shb ) {
      //To change body of implemented methods use File | Settings | File Templates.
    }
  }

  @Override
  public <T> NodeInfo<?> getNodeInfo( T value ) {

    if ( value == null )
      return new DefaultNodeInfo<JsNationalUnion>( new NationalUnionDataProvider(), new NationalUnionCell() );

    throw new IllegalArgumentException( "Unhandled node type: " + value.getClass().getName() );
  }

  @Override
  public boolean isLeaf( Object o ) {
    return false;  //To change body of implemented methods use File | Settings | File Templates.
  }
}
